package com.shared.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class RestDTO {
    public static final RestDTO ADD_SUCCESS = new RestDTO(2000, "添加成功");
    public static final RestDTO ADD_FAILURE = new RestDTO(-2000, "添加失败");
    public static final RestDTO UPDATE_SUCCESS = new RestDTO(3000, "修改成功");
    public static final RestDTO UPDATE_FAILURE = new RestDTO(-3000, "修改失败");
    public static final RestDTO SEX_FAILURE = new RestDTO(-1000, "性别不合法");
    public static final RestDTO Cat_MAX = new RestDTO(1000, "购买上限");

    private int code;
    private String msg;
    private String data;

    //双参构造
    private RestDTO(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public RestDTO(int code, String msg, String data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
}
